﻿using System;
using System.Collections.Generic;
using System.Web;
using System.Web.Services;
using System.Data;

/// <summary>
/// Summary description for servicio
/// </summary>
[WebService(Namespace = "http://tempuri.org/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
[System.Web.Script.Services.ScriptService]
public class categoriaPost : System.Web.Services.WebService
{

    CategoriaPostServices CategoriasPost = new CategoriaPostServices();

    public categoriaPost()
    {
        //Uncomment the following line if using designed components 
        //InitializeComponent(); 
    }

    [WebMethod]
    [System.Web.Script.Services.ScriptMethod(ResponseFormat = System.Web.Script.Services.ResponseFormat.Json)]
    public List<CategoriaPostDTO> ObtenerCategoriasPost()
    {
        List<CategoriaPostDTO> categorias = new List<CategoriaPostDTO>();
        DataSet ds = CategoriasPost.ObtenerCategoriasPost();

        if (ds.Tables.Count > 0)
        {
            foreach (DataRow row in ds.Tables[0].Rows)
            {
                CategoriaPostDTO dto = new CategoriaPostDTO(row);
                categorias.Add(dto);
            }
        }

        return categorias;

       
    }
}
